{% set variant = hookable_metadata.context.variant %}
{% set channels = hookable_metadata.context.channels %}

<div class="card mb-3">
    <div class="card-header">
        <div class="card-title">{{ 'sylius.ui.pricing'|trans }}</div>
    </div>
    <div class="table-responsive">
        <table class="table card-table table-vcenter">
            <thead>
                <tr>
                    {% hook 'pricing#head' %}
                </tr>
            </thead>
            <tbody>
            {% for channel_pricing in variant.channelPricings %}
                {% set channel = attribute(channels, channel_pricing.channelCode) is defined ? attribute(channels, channel_pricing.channelCode) : null %}

                {% if channel %}
                    {% set currency_code = channel.baseCurrency.code %}
                    {% set channel = attribute(channels, channel_pricing.channelCode) %}

                    <tr {{ sylius_test_html_attribute('simple-product', "%s"|format(channel.code)) }} {{ sylius_test_html_attribute('pricing', "%s"|format(channel.code)) }} >
                        {% hook 'pricing#body' with { variant, channel, channel_pricing, currency_code } %}
                    </tr>
                {% else %}
                    {% hook 'pricing#body' with { variant, channel_pricing } %}
                {% endif %}
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
